#pragma once

/*
 * time function list.
 */

#include <chrono>
#include <ctime>

// cross platform functions.
#if !defined(_WIN32)
#include <sys/time.h>
  // Sleep for Linux.
  #ifndef Sleep
    #define Sleep(x)  usleep((x) * 1000)
  #endif
  
  // define zone.
  #ifndef CURRENT_ZONE_MINUTES
    #define CURRENT_ZONE_MINUTES (-480)
  #endif

// for Linux like os as windows GetTickCount() function.
static inline long long GetTickCount64() {
    struct timeval now;
	struct timezone zone;
	gettimeofday(&now, &zone);
	return (now.tv_sec - CURRENT_ZONE_MINUTES * 60L) * 1000 + now.tv_usec / 1000;
}
#else
    // for GetTickCount() function.
    #include <windows.h.>
    #pragma warning(disable:4996)
#endif

// GetNowTime gets now time.
static long long GetNowMSTime() {
    return GetTickCount64();
}